package com.itheima.question.controller;

import com.itheima.Result;
import com.itheima.question.dto.QuestionDto;
import com.itheima.question.service.IQuestionService;
import com.itheima.question.service.impl.QuestionServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/question")
@Api(value = "答题模块-题目接口", tags = "admin_user", description = "用于实现后台题目的增删改查操作")
public class QuestionController {

    @Autowired
    private QuestionServiceImpl questionService;

    @PostMapping("/add")
    @ApiOperation("添加题目")
    public Result addQuestion(@RequestBody QuestionDto questionDto){
        boolean result  = questionService.addQuestion(questionDto);
        return new Result(result,result?"添加试题成功":"添加试题失败",null);
    }
}
